var express = require('express');
var router = express.Router();


const {
  getGetOrdersList,postOrdersAdd,applyOrders,deleteOrders,getOrdersId,getOrdersSalesIdList,getOrdersOne
} = require('../service/ordersService')

/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/getOrders',async function(req, res, next) {
  res.send(await getGetOrdersList(req.query))
});

router.post('/postOrdersAdd',async function(req, res, next) {
  res.send(await postOrdersAdd(req.body))
});

router.post('/applyOrders',async function(req, res, next) {
  res.send(await applyOrders(req.body))
});

router.post('/deleteOrders',async function(req, res, next) {
  res.send(await deleteOrders(req.body))
});

router.get('/getOrdersId',async function(req, res, next) {
  res.send(await getOrdersId(req.query))
});

router.get('/getOrdersSalesIdList',async function(req, res, next) {
  res.send(await getOrdersSalesIdList(req.query))
});
//获取单个订单信息
router.post('/getOrdersOne',async function(req, res, next) {
    const data=await getOrdersOne(req.body)
    res.send(data)
});
module.exports = router;
